/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.core.entities.cms;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import com.viettel.core.enumtype.FAQsStatus;

/**
 *  TABLE Cau hoi FAQs
 *  @author: ToanTM1
 *  @version: 2.1
 *  @since: 27-02-2014 - 18:28:51
 */
@Entity
@Table(name = "FAQs")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "FAQs_SEQ", allocationSize = 1)
public class FAQs  implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -184851343080602315L;

	/**
	 * id
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
	@Column(name = "ID")
//	@Index(name="FAQs_ID_PK")
	private Integer id;
	
	/**
	 * NOI DUNG CAU HOI
	 */
	@Basic
	@Column(name = "QUESTION", length = 500)
	private String name;
	
	/**
	 * NOI DUNG CAU TRA LOI
	 */
	@Basic
	@Column(name = "ANSWER", length = 2000)
	private String answer;
	
	/**
	 * CAU HOI THUOC LOAI GI?
	 */
	@ManyToOne(targetEntity = GroupCategory.class)
	@JoinColumn(name = "GROUP_CATEGORY_ID", referencedColumnName = "id")
	@ForeignKey(name = "FAQs_GROUP_CATEGORY_FK")
	private GroupCategory groupCategory;
	
	/**
	 * TRANG THAI
	 */
	@Basic
	@Column(name = "STATUS", columnDefinition = "NUMBER(1,0)", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.FAQsStatus"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="FAQs_STATUSX")
	private FAQsStatus status;
	
	/**
	 * THOI GIAN CAP NHAT
	 */
	@Basic
	@Column(name = "MODIFIED_TIME", columnDefinition = "timestamp(9) default systimestamp", insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date modifiedTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public GroupCategory getGroupCategory() {
		return groupCategory;
	}

	public void setGroupCategory(GroupCategory groupCategory) {
		this.groupCategory = groupCategory;
	}

	public FAQsStatus getStatus() {
		return status;
	}

	public void setStatus(FAQsStatus status) {
		this.status = status;
	}

	public Date getModifiedTime() {
		return modifiedTime;
	}

	public void setModifiedTime(Date modifiedTime) {
		this.modifiedTime = modifiedTime;
	}
}
